import { createStore, combineReducers } from "redux";
// 持久化缓存
import { persistStore, persistReducer } from "redux-persist";
import storage from "redux-persist/lib/storage";

import collapsed from "./reducers/collapsed";
import loading from "./reducers/loading";

const persistConfig = {
  key: "le",
  storage,
  whitelist: ['collapsed'] // only navigation will be persisted
};
const reducers = combineReducers({
  collapsed,
  loading
});

const persistedReducer = persistReducer(persistConfig, reducers);
const store = createStore(persistedReducer);
const persistor = persistStore(store);
export { store, persistor };
